<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="statics/layui/css/layui.css" />
		<script type="text/javascript" src="statics/js/jquery-1.12.4.js"></script>
		<script type="text/javascript" src="statics/layui/layui.js"></script>
		<style type="text/css">
			.layui-input {
				margin-top: 10px;
				height: 30px;
			}
			
			.layui-form-label {
				margin-top: 5px;
			}
			
			.layui-input-inline {
				float: left;
			}
			
			.zhi {
				width: 0px;
				margin-right: 15px;
			}
			
			.bottom2 {
				position: relative;
				left: 200px;
			}
			
			.mx .dc .sh {
				cursor: pointer;
			}
			
			.bottom1 {
				position: relative;
				left: 200px;
			}
		</style>
	</head>

	<body>
		<form class="layui-form" action="mortgageGetAll" id="form1">
			<div class="layui-inline">
				<label class="layui-form-label">金融单号</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="mortgageSheetNo" autocomplete="off" class="layui-input" value="${map.mortgageSheetNo!}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">VIN</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input" value="${map.vin!}">
				</div>
			</div>

			<div class="layui-inline">
				<label class="layui-form-label">车主编号</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="customer.customerId" autocomplete="off" class="layui-input" value="${map.customerId!}">
				</div>
			</div>

			<div class="layui-inline">
				<label class="layui-form-label">车主姓名</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="customer.customerName" autocomplete="off" class="layui-input" value="${map.customerName!}">
				</div>
			</div>
			<br>
			<div class="layui-inline">
				<label class="layui-form-label">销售单号</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="orderId" autocomplete="off" class="layui-input" value="${map.orderId!}">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">金融机构</label>
				<div class="layui-input-inline" style="width: 150px;">
					<select name="bank.bankName" lay-verify="">
						<option value="-1">请选择</option>
						<#list bankList! as bank>
							<#if map.bankName! == bank.bankName!>
							 	<option value="${bank.bankName!}" selected="selected">${bank.bankName!}</option>
							<#else>
								<option value="${bank.bankName!}">${bank.bankName!}</option>
							</#if>
						</#list>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">开单人</label>
				<div class="layui-input-inline" style="width: 150px;">
					<select name="employee.employeeName" lay-verify="">
						<option value="-1">请选择</option>
						<#list employeeList! as employee>
							<#if map.employeeName! == employee.employeeName!>
							 	<option value="${employee.employeeName!}" selected="selected">${employee.employeeName!}</option>
							<#else>
								<option value="${employee.employeeName!}">${employee.employeeName!}</option>
							</#if>
						</#list>
					</select>
				</div>
			</div>

			<div class="layui-inline">
				<label class="layui-form-label">订单状态</label>
				<div class="layui-input-inline" style="width: 150px;">

					<select name="mortgageSheetState" lay-verify="" id="ddState">
						<option value="-1" selected="selected">请选择</option>
						<option value="未提交">未提交</option>
						<option value="已提交">已提交</option>
						<option value="审核通过">审核通过</option>
						<option value="审核驳回">审核驳回</option>
						<option value="已取消">已取消</option>
						<option value="已关单">已关单</option>
						<option value="${map.mortgageSheetState!}" style="display: none;" id="ddState1"></option>
					</select>
				</div>
			</div>

			<div class="layui-form-inline">
				<label class="layui-form-label">开单时间</label>
				<div class="layui-input-inline">
					<input type="text" id="start_time" name="start_time" autocomplete="off" placeholder="请输入开始时间" class="layui-input" value="${map.start_time!}">
				</div>
				<label class="layui-form-label zhi">至</label>
				<div class="layui-input-inline">
					<input type="text" id="end_time" name="end_time" autocomplete="off" placeholder="请输入结束时间" class="layui-input" value="${map.end_time!}">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-inline bottom2">
					<button class="layui-btn" lay-submit lay-filter="formDemo">查询</button>
					<button type="reset" class="layui-btn" id="reset">重置</button>
				</div>
			</div>
			<input type="text" name="pageNo" value="" id="pageNo" style="display: none;"/>
			
		</form>
		<!--分页-->
		<script type="text/javascript">
			function do_page(pageNo) {
				document.getElementById("pageNo").value = pageNo;
				document.getElementById("form1").submit();
			}
		</script>

		<table class="layui-table" lay-skin="line">
			<thead>
				<tr>
					<th>序号</th>
					<th>操作</th>
					<th>金融单号</th>
					<th>VIN</th>
					<th>客户代码</th>
					<th>客户名称</th>
					<th>金融机构</th>
					<th>车价</th>
					<th>贷款金额</th>
					<th>服务费</th>
					<th>单据状态</th>
					<th>开单人</th>
					<th>开单日期</th>
					<th>销售单号</th>
				</tr>
			</thead>
			<tbody>
				<script type="text/javascript">
					function renderTime(date) {
						var da = new Date(parseInt(date.replace("/Date(", "").replace(")/", "").split("+")[0]));
						return da.getFullYear() + "-" + (da.getMonth() + 1) + "-" + da.getDate();
					}
					$(function() {
						$(".demo30").focus(function() {
							$.ajax({
								type: "get",
								url: "selopinion",
								success: function(data) {
									$(".demo30").val(data);
								},
								async: true
							});
						})
						
						//重置
						$("#reset").click(function(){
							window.location.href="mortgageGetAll";
						});

						$("#ddState option").each(function(index) {
							var ddState1 = document.getElementById("ddState1").value;
							if(ddState1 == $(this).val()) {
								$("#ddState").val(ddState1);
							}
						})

					})

					function openModak(id) {
						$.ajax({
							type: "get",
							url: "selMortgage?id=" + id,
							dataType: "json",
							contentType: "application/json;charset=utf-8",
							success: function(data) {
								$(".demo1").val(data.orderId);
								$(".demo2").val(data.mortgageSheetNo);
								$(".demo3").val(renderTime(data.mortgageSheetDate + ""));
								$(".demo4").val(data.employeeName);
								$(".demo5").val(data.mortgageSheetState);
								$(".demo6").val(data.customerId);
								$(".demo7").val(data.customerName);
								$(".demo8").val(data.customerTel);
								$(".demo9").val(data.customerCardId);
								$(".demo10").val(data.brand);
								$(".demo11").val(data.series);
								$(".demo12").val(data.model);
								$(".demo13").val(data.configure);
								$(".demo14").val(data.color);
								$(".demo15").val(data.vin);
								$(".demo16").val(data.price);
								$(".demo17").val(data.bankName);
								$(".demo18").val(data.bankType);
								$(".demo19").val(data.loanTime);
								$(".demo20").val(data.loanMoney);
								$(".demo21").val(data.downPayments);
								$(".demo26").val(data.serviceCharge);
								$(".demo27").val(data.interestRate);
							}

						});

						layui.use(['layer'], function() {
							var layer = layui.layer,
								$ = layui.$;
							layer.open({
								type: 1, //类型
								area: ['1000px'], //定义宽和高
								title: '金融按揭审核', //题目
								shadeClose: false, //点击遮罩层关闭
								content: $('.jrsh'), //打开的内容
								btn: ['审核通过', '审核驳回', '取消'],
								yes: function(index, layero) {
									var isConsent = $(".demo29").val();
									var opinion = $(".demo30").val();
									if(isConsent == -1) {
										layer.alert('至少有一项是 同意，才能审核通过', {
											icon: 5,
											title: "提示"
										});
									} else if(isConsent == 0) {
										return false;
									} else if(opinion == "") {
										layer.alert('请填写审核意见', {
											icon: 5,
											title: "提示"
										});
									} else {
										layer.confirm('是否确认审核？', {
											btn: ['确定', '取消'] //按钮
										}, function() {
											$.ajax({
												type: "get",
												url: "mortgageSheetSH?opinion=" + opinion,
												success: function(data) {
													if(data == true) {
														window.location.href = "mortgageGetAll";
													}
												},
												async: true
											});
											layer.alert("很好")
										});
									}
								},
								btn2: function(index, layero) {
									var isConsent = $(".demo29").val();
									var opinion = $(".demo30").val();
									if(isConsent == -1) {
										layer.alert('至少有一项是 同意，才能审核通过', {
											icon: 5,
											title: "提示"
										});
									} else if(isConsent == 1) {
										return false;
									} else if(opinion == "") {
										layer.alert('请填写审核意见', {
											icon: 5,
											title: "提示"
										});
									} else {
										layer.open({
											type: 1, //类型
											area: ['1100px'], //定义宽和高
											title: '金融按揭审核', //题目
											shadeClose: false, //点击遮罩层关闭
											content: $('.jrsh'),
										})
										layer.confirm('是否确认驳回？', {
											btn: ['确定', '取消'] //按钮
										}, function() {
											$.ajax({
												type: "get",
												url: "mortgageSheetBH?opinion=" + opinion,
												success: function(data) {
													if(data = true) {
														window.location.href = "mortgageGetAll";
													}
												},
												async: true
											});
											layer.alert("很好")
										});
									}
								},
								cancel: function(index, layero) {
									if(confirm('确定要关闭么')) { //只有当点击confirm框的确定时，该层才会关闭
										layer.close(index)
									}
									return false;
								},

							});
						})
					}

				</script>
				<#list pageInfo.list as mortgage>
					<tr>
						<td>${mortgage_index+1}</td>
						<td>
							<img class="sh" src="statics/icon/027-sh.png" alt="审核" title="审核" onclick="openModak(${mortgage.mortgageSheet.mortgageSheetNo!})" />
						</td>
						<td>${mortgage.mortgageSheet.mortgageSheetNo!}</td>
						<td>${mortgage.car.vin!}</td>
						<td>${mortgage.customer.customerId!}</td>
						<td>${mortgage.customer.customerName!}</td>
						<td>${mortgage.bank.bankName!}</td>
						<td>${mortgage.car.price!}</td>
						<td>${mortgage.mortgageSheet.loanMoney!}</td>
						<td>${mortgage.mortgageSheet.serviceCharge!}</td>
						<td class="state1">${mortgage.mortgageSheet.mortgageSheetState!}</td>
						<td>${mortgage.employee.employeeName!}</td>
						<td>${mortgage.mortgageSheet.mortgageSheetDate!}</td>
						<td>${mortgage.mortgageSheet.orderId!}</td>
					</tr>

				</#list>
				<script type="text/javascript">
					$(function() {
						$(".state1").each(function(index) {
							if($(this).html() != "已提交") {
								$(this).parent().find(".sh").attr("src", "statics/icon/027-sh2.png");
								$(this).parent().find(".sh").attr('onclick', '').unbind('click');
							}
						})
					})
				</script>
				<tr>
					<td colspan="10" align="center">
						<a href="javascript:do_page(1)">首页</a>&nbsp;
						<a href="javascript:do_page(${pageInfo.pageNo-1})">上一页</a>&nbsp;
						<a href="javascript:do_page(${pageInfo.pageNo+1})">下一页</a>&nbsp;
						<a href="javascript:do_page(${pageInfo.pageTotal})">末页</a>&nbsp;&nbsp; ${pageInfo.pageNo} /${pageInfo.pageTotal}页 &nbsp;
						<input name="pageNumber" type="text" id="pageNumber" size="5" />
						<input type="button" name="btnQuery2" id="btnQuery2" value="GO" /> </td>
				</tr>
			</tbody>
		</table>

		<form id="jrsh" class="layui-form jrsh" lay-filter="formTest" style="display: none;">

			<div class="layui-inline">
				<label class="layui-form-label">销售单号</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="oredrId" autocomplete="off" class="layui-input demo1" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">金融单号</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="mortgageSheetNo" autocomplete="off" class="layui-input demo2" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">开单日期</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="mortgageSheetDate" autocomplete="off" class="layui-input demo3" id="kdrq" disabled="disabled">
				</div>
			</div>
			<br />
			<div class="layui-inline">
				<label class="layui-form-label">开单人</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="employeeName" autocomplete="off" class="layui-input demo4" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">单据状态</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="mortgageSheetState" autocomplete="off" class="layui-input demo5" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">客户编号</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="customerId" autocomplete="off" class="layui-input demo6" disabled="disabled">
				</div>
			</div>
			<br />
			<div class="layui-inline">
				<label class="layui-form-label">客户名称</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="customerName" autocomplete="off" class="layui-input demo7" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">联系电话</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="customerTel" autocomplete="off" class="layui-input demo8" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">证件代码</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="customerCardId" autocomplete="off" class="layui-input demo9" disabled="disabled">
				</div>
			</div>
			<br />
			<div class="layui-inline">
				<label class="layui-form-label">品牌</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="brand" autocomplete="off" class="layui-input demo10" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">车系</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="series" autocomplete="off" class="layui-input demo11" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">车型</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="model" autocomplete="off" class="layui-input demo12" disabled="disabled">
				</div>
			</div>
			<br />
			<div class="layui-inline">
				<label class="layui-form-label">配置</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="configure" autocomplete="off" class="layui-input demo13" disabled="disabled">
				</div>
			</div>

			<div class="layui-inline">
				<label class="layui-form-label">颜色</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="color" autocomplete="off" class="layui-input demo14" disabled="disabled">
				</div>
			</div>

			<div class="layui-inline">
				<label class="layui-form-label">VIN</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="vin" autocomplete="off" class="layui-input demo15" disabled="disabled">
				</div>
			</div>
			<br />
			<div class="layui-inline">
				<label class="layui-form-label">车辆销售价</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="price" autocomplete="off" class="layui-input demo16" disabled="disabled">
				</div>
			</div>
			<br />
			<div class="layui-inline">
				<label class="layui-form-label">金融机构</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="bankName" autocomplete="off" class="layui-input demo17" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">机构类型</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="bankType" autocomplete="off" class="layui-input demo18" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">贷款期限(月)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="loanTime" autocomplete="off" class="layui-input demo19" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">贷款金额(元)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="loanMoney" autocomplete="off" class="layui-input demo20" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">首付款(元)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="downPayments" autocomplete="off" class="layui-input demo21" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">主机厂贴息(元)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="" autocomplete="off" class="layui-input demo22" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">集团贴息(元)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="" autocomplete="off" class="layui-input demo23" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">第三方贴息(元)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="" autocomplete="off" class="layui-input demo24" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">自付利息(元)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="" autocomplete="off" class="layui-input demo25" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">服务费(元)</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="serviceCharge" autocomplete="off" class="layui-input demo26" disabled="disabled">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">费率/利率</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="interestRate" autocomplete="off" class="layui-input demo27">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">按揭资质</label>
				<div class="layui-input-inline" style="width: 200px;">
					<input type="text" name="" autocomplete="off" class="layui-input demo28">
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">是否同意</label>
				<div class="layui-input-inline" style="width: 200px;">
					<select name="" lay-verify="" class="demo29">
						<option value="-1"></option>
						<option value="1">同意</option>
						<option value="0">不同意</option>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">审核意见</label>
				<div class="layui-input-inline" style="width: 400px;">
					<input type="text" name="" autocomplete="off" class="layui-input demo30">
				</div>
			</div>
		</form>

		<script>
			//审核通过

			//Demo
			layui.use('form', function() {
				var form = layui.form;
				//监听提交
			});
			//日期
			layui.use('laydate', function() {
				var laydate = layui.laydate;
				var endDate = laydate.render({
					elem: '#end_time', //选择器结束时间
					type: 'date',
					min: "1970-1-1", //设置min默认最小值
					done: function(value, date) {
						startDate.config.max = {
							year: date.year,
							month: date.month - 1, //关键
							date: date.date,
							hours: 0,
							minutes: 0,
							seconds: 0
						}
					}
				});
				//日期范围
				var startDate = laydate.render({
					elem: '#start_time',
					type: 'date',
					max: "2099-12-31", //设置一个默认最大值
					done: function(value, date) {
						endDate.config.min = {
							year: date.year,
							month: date.month - 1, //关键
							date: date.date,
							hours: 0,
							minutes: 0,
							seconds: 0
						};
					}
				});

				laydate.render({
					elem: '#kdrq' //指定元素
				});

			});
			//客户分期调查
			function fqdc(customerId){
				layui.use(['layer'], function() {
							var layer = layui.layer,
							$ = layui.$;
							layer.open({
								type: 1, //类型
								area: ['1100px'], //定义宽和高
								title: '金融按揭审核', //题目
								shadeClose: false, //点击遮罩层关闭
								content: $('#khfqdc'), //打开的内容
								cancel: function(index, layero) {
									if(confirm('确定要关闭么')) { //只有当点击confirm框的确定时，该层才会关闭
										layer.close(index)
									}
									return false;
								},

							});
						})
			}
			
			
		</script>

	</body>

	<div class="layui-form" id="khfqdc" style="display: none;">
		<div class="layui-inline">
				<label class="layui-form-label">客户编号</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">客户姓名</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">籍贯</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">婚姻状况</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<br />
		<div class="layui-inline">
				<label class="layui-form-label">证件号</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">预购车系</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">预购车型</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">按揭需求</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">预购车型</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
		<div style="height: 40px;background-color: rgb(248,248,248);">
			<label class="layui-form-label">房产信息</label>
		</div>
		<div class="layui-inline">
				<label class="layui-form-label">是否</label>
				<div class="layui-input-inline" style="width: 150px;">
					<input type="text" name="car.vin" autocomplete="off" class="layui-input">
				</div>
		</div>
	</div>

</html>